<template>
  <div class="tablewrap">
    <div>出险信息</div>
    <FilterTable
      :columns="columns"
      :dataSource="dataSource"
      :height="200"
      :onColumnsChange="columns => (this.columns = columns)"
      :isColumnFilter="false"
      :onRowSelectChange="rowSelectChange"
    ></FilterTable>
  </div>
</template>

<script>
import moment from 'moment';
import { queryOccurInsuranceByLicenseOrVin } from '@/api/repair/repairReception/customer/monitoring.js';
export default {
  name: 'ChuXianInfo',
  props: {
    queryParams: Object
  },
  data() {
    return {
      // 出险信息
      dataSource: [],
      columns: this.createColumnsInsurance(),
      selectRow: []
    };
  },
  mounted() {
    this.queryOccurInsuranceByLicenseOrVin();
  },
  methods: {
    rowSelectChange(opt) {
      console.log(opt);
      this.selectRow = opt;
      this.$emit('selectChange', opt);
    },
    async queryOccurInsuranceByLicenseOrVin() {
      // 需要参数
      const params = {
        sort: 'OCCUR_INSURANCE_NO',
        order: 'asc',
        limit: 10,
        offset: 0,
        ...this.queryParams
        // LICENSE: '陕A2FU00',
        // vin: '09876543219876543',
        // ownerNo: 'OW1907110001',
        // BRAND: 'LINCOLN',
        // MILEAGE: 999999,
        // isRepairOrder: 'REPAIR_ORDER_TAG',
        // createDate: moment().format('YYYY-MM-DD HH-mm'),
        // dmsFuncId: 35100010,
        // _: moment().valueOf()
      };
      const res = await queryOccurInsuranceByLicenseOrVin(params);
      this.dataSource = res;
    },
    createColumnsInsurance() {
      return [
        {
          title: '序号'
        },
        {
          title: '出险单号',
          dataIndex: 'OCCUR_INSURANCE_NO'
        },
        {
          title: '报案人',
          dataIndex: 'REPORT_MAN'
        },
        {
          title: 'VIN',
          dataIndex: 'VIN'
        },
        {
          title: '车牌号',
          dataIndex: 'LICENSE'
        },
        {
          title: '品牌',
          dataIndex: 'BRAND'
        },
        {
          title: '车系',
          dataIndex: 'SERIES'
        },
        {
          title: '车型',
          dataIndex: 'MODEL'
        },
        {
          title: '客户来源',
          dataIndex: 'CUS_SOURCE'
        }
      ];
    }
  }
};
</script>

<style scoped></style>
